class Solution(object):
    def getAverages(self, nums, k):
        n = len(nums)
        for i in range(1, n):
            nums[i] += nums[i - 1]
        ans = [-1] * n
        for i in range(k, n - k):
            if i == k:
                ans[i] = nums[i + k] // (2 * k + 1)
            else:
                ans[i] = (nums[i + k] - nums[i - k - 1]) // (2 * k + 1)
        return ans